package model;


import static org.junit.Assert.*;

import java.awt.Color;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;


import model.playingfield.PlayingField;

/**
 * This test asserts that all the Spots on the circuit link correctly to each other
 *
 */
public class PlayingFieldTest4 {

    PlayingField playingfield;
    Player[] players;

    @Before
    public void setUp() throws Exception {

    Player p1 = new Player("Nils", Color.black, 0);
    Player p2 = new Player("Mils", Color.blue, 1);
    Player p3 = new Player("Wils", Color.red, 2);
    Player p4 = new Player("Kils", Color.green, 3);

    Player[] playersSet = {p1, p2, p3, p4};
    players = playersSet;

    playingfield = new PlayingField(players);
    }

    @Test
    public void testCheckPieces() throws Exception {

        boolean fail = false;

        for(int i = 0; i < 39; i++)
            if(playingfield.getSpot(i + 1) != playingfield.getSpot(i).getNextSpot())
                fail = true;

        if(playingfield.getSpot(0) != playingfield.getSpot(39).getNextSpot())
            fail = true;

        assertFalse(fail);
    }

    @After
    public void tearDown() throws Exception {
    }

}

